package fr.insee.sicape.bean;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class Echo implements Iterable<Apet>, Comparable<Echo>{

	private int frequence, frequence5;
	private List<Apet> apets;
	
	public Echo() {
		super();
		apets = new ArrayList<Apet>(5);
	}

	public int getFrequence() {
		return frequence;
	}

	public void setFrequence(int frequence) {
		this.frequence = frequence;
	}

	public int getFrequence5() {
		return frequence5;
	}

	public void setFrequence5(int frequence5) {
		this.frequence5 = frequence5;
	}

	public List<Apet> getApets() {
		return apets;
	}

	public void setApets(List<Apet> apets) {
		this.apets = apets;
	}

	@Override
	public Iterator<Apet> iterator() {
		return apets.iterator();
	}
	
	public void add(Apet apet){
		this.apets.add(apet);
	}
	
	public Apet get(int index){
		return this.apets.get(index);
	}
	
	public int size(){
		return apets.size();
	}

	@Override
	public int compareTo(Echo other) {
		
		if(this.frequence5 == other.frequence5){
			return 0;
		}
		else if(this.frequence5 > other.frequence5){
			return 1;
		}
		else{
			return -1;
		}
	}
}
